package com.yzd.learnjava.generics;

import com.yzd.learnjava.typeinfo.pets.Dog;
import com.yzd.learnjava.util.Print;

public class DogsAndRobots {
	public static void main(String[] args) {
		PerformingDog d = new PerformingDog();
		Robot robot = new Robot();
		
		Communicate.perform(d);
		Communicate.perform(robot);
	}
}

interface Performs{
	void speak();
	void sit();
}

class PerformingDog extends Dog implements Performs{
	public void speak() {
		Print.print("Woof");
	}
	public void sit() {
		Print.print("Sitting");
	}
	
	public void reproduce() {}
}

class Robot implements Performs{
	public void speak() {
		Print.print("Click");
	}

	public void sit() {
		Print.print("Clank");
	}
}

class Communicate{
	public static <T extends Performs> void perform(T perform) {
		perform.speak();
		perform.sit();
	}
}

